<!DOCTYPE html>
<extend name="Base/base" />
<block name='head'>  
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="initial-scale=1,maximum-scale=1, minimum-scale=1">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <link href="/Public/Index/css/new_plan.css" rel="stylesheet" /> 
    <link rel="stylesheet" href="/Public/Index/css/plan/details.css" media="screen" type="text/css" />
    <!--必要样式-->
    <link rel="stylesheet" href="/Public/Index/css/plan/style.css" media="screen" type="text/css" />
    <style>
/*        .progress{position: relative; width:300px;margin:100px auto;}
        .progress_bg{height: 10px; border: 1px solid #ddd; border-radius: 5px; overflow: hidden;background-color:#f2f2f2;}
        .progress_bar{background: #5FB878; width: 0; height: 10px; border-radius: 5px;}
        .progress_btn{width: 20px; height: 20px; border-radius: 5px; position: absolute;background:#fff; 
        left: 0px; margin-left: -10px; top:-5px; cursor: pointer;border:1px #ddd solid;box-sizing:border-box;}
        .progress_btn:hover{border-color:#F7B824;}*/
    </style>

<!--<title>添加进度日志</title>-->
</block>
<block name="content" > 
    <form>
        <div class="detail-content">
            <div class="detail-middle-line">
                <span class="detail-line-text">进度日志详情</span>
            </div>
            <if condition="$plan[info] neq null">
                <foreach name='plan.info' item='detail'>
                    <div class="plan_details">
                        <div class="list_det">
                            <dl>
                                <dt class="det1 title_1"><img src="/Public/Index/img/icon_0.svg" />{$detail.write_time}</dt>
                                <dd class="det1"><span>完成{$detail.percent}%</span></dd>
                            </dl>
                            <dl>
                                <dt class="det2">             
                                    <span class="det_nr">{$detail.progress|htmlspecialchars_decode}</span>
                                </dt>
                            </dl>
                        </div>
                    </div>
                </foreach>
            <else />
                <div class="plan_details">无进度日志</div>
            </if>
            <div class="add_detl">
                <div class="detail-middle-line"  style="margin-top:18px;">
                    <span class="detail-line-text">添加进度日志</span>
                </div>
                <div class="add_detl_nr">
                    <h4>完成百分比&nbsp;&nbsp;<span>(上次进度值{$plan.total|default=0}%)</span></h4>
                    <input type='hidden' name='percent' id='percent' value='222wd'>
                    <input type="hidden" name="old_total" value="{$plan.total|default=0}">
                    <div class="range-holder">
                        <div id="pr-slider1" class="dragdealer1">
				<div class="stripe1">
					<div class="handle1">
						<div class="infobox1">
							<div class="innerbox1">
								<div class="info-price1"></div>
							</div>
						</div>		
					</div>
				</div>
			</div>
			<div id="pr-slider2" class="dragdealer2">
				<div class="stripe2">
					<div class="handle2">
						<div class="infobox2">
							<div class="innerbox2">
								<div class="info-price2"></div>
							</div>
						</div>		
					</div>
				</div>
			</div>
                        <div id="pr-slider" class="dragdealer">
                            <div class="stripe">
                                <div class="handle">
                                    <div class="infobox">
                                        <div class="innerbox">
                                            <div class="info-price"></div>
                                        </div>
                                    </div>		
                                    <div class="square">
                                        <span class="value"></span>
                                        <span class="menu-line"></span>
                                        <span class="menu-line"></span>
                                        <span class="menu-line"></span>
                                    </div>	
                                </div>
                            </div>
                        </div>
                    </div>
<!--                    <div class="progress">
                        <div class="progress_bg">
                            <div class="progress_bar"></div>
                        </div>
                        <div class="progress_btn"></div>
                        <div class="text">0%</div>
                    </div>-->
                </div>
                <div class="add_detl_nr">
                    <h4>进度详情</h4>
                    <textarea name="progress"></textarea>
                </div>
                <div class="add_detl_nr">
                    <h4>是否写入工作日志</h4>
                    <lable>
                        <i class='input_style radio_bg'><input type="radio" name="is_diary" value="1" ></i>
                      是
                    </lable>
                    <lable>
                        <i class='input_style radio_bg radio_bg_check'><input type="radio" name="is_diary" value="0" checked></i>
                        否
                    </lable>
                </div>
                <div class="add_detl_nr">
                    <h4>附件</h4>
                    <a href="#" id="upload"><span class="icon_add">&#xe638;</span><span class="fj">上传附件</span></a>
                    <div class="line filename-cont">
                        <!--                                <if condition="$uploads neq null">
                                                            <foreach name="uploads" item="img">
                                                                <span>
                                                                    <img src="{$img.url}" style="width:100px">
                                                                    <img src="/Public/Index/img/close.png" style="width:15px" class="pointer delfile" data-fileurl="{$img.url}"/>
                                                                </span><br/>
                                                            </foreach>
                                                        </if>-->
                    </div>
                    <input type="file" id="inputImage" name='imgfile' style="display:none">
                    <input type="hidden" id="filename" name="uploads" value="">
                    <input type="hidden" id="fileurl" name="uploads_url" value="">
                    <input type="hidden" name="url" value="{:U('delFile')}">
                </div>
<!--                <div class="button" style="text-align:center">
                    <span>
                        <a class="pointer btn-submit planSubmit ajax-post" style='background: #ED8D76;' data-verify="all" data-url="{:U('schedule')}" data-form="">提交</a>
                        <a class="pointer btn-submit" onclick="history.go(-1)">返回</a>
                    </span>
                </div>-->
                <div class="submit_tj">
                    <p><input type="button" class="sub_tj pointer btn-submit ajax-post" data-url="{:U('schedule')}" data-form="" value="提&nbsp;&nbsp; 交" ></p>
                    <!--<p><input type="button" class="sub_bc pointer btn-submit ajax-post" data-url="{:U('schedule',array('type'=>1))}" data-form="" value="保&nbsp;&nbsp; 存" ></p>-->
                </div>
            </div>
            <input type="hidden" name="plan_id" value="{$plan_id}">
            <input type="hidden" name="is_end" value="{$is_end}">
            <input type="hidden" name="dept" value="{$dept}">
            <input type="hidden" name="cType" value="{$cType}">
            <input type="hidden" name="lng" value="" />
            <input type="hidden" name="lat" value="" />
            <!--从关注列表中点进来加标记-->
            <input type='hidden' name="is_follow" value="{$type}" /> 
            <input type="hidden" id="prevProress" value="{$plan.total|default=0}" />
        </div>
    </form>
</block>
<block name="script">
    <script type="text/javascript" src='/Public/Index/js/plan/jquery.js'></script>
    <script type="text/javascript" src="/Public/Index/js/plan/index.js"></script>
    <script src="https://api.map.baidu.com/api?v=2.0&ak=ZoVYMpI2FZWKafTn6GIjojqinVFGHMbI&s=1" type="text/javascript"></script>  
    <script type="text/javascript" src="http://developer.baidu.com/map/jsdemo/demo/convertor.js"></script> 
    <script type="text/javascript" src="/Public/Index/js/plan.js"></script>
    <!--文件上传-->
    <script type="text/javascript" src="__PUBLIC__/Cropper/js/ajaxfileupload.js" ></script>
    <script type="text/javascript">
        $(initSchedule())
        $(initUpload("{:U(CONTROLLER_NAME.'/upload')}"));
        $(function () {
            var geolocation = new BMap.Geolocation();
            geolocation.getCurrentPosition(function (r) {
                if (this.getStatus() == BMAP_STATUS_SUCCESS) {
                    var mk = new BMap.Marker(r.point);
                    lat = r.point.lat; //纬度
                    lng = r.point.lng;   //经度
                    $('body').find('input[name=lng]').val(lng);
                    $('body').find('input[name=lat]').val(lat);
////                        alert(lat);alert(lng)
////                        $.get($('#url').val(),{lng:currentLon,lat:currentLat},function(res){
////                            console.log(res)
////                        })
                }
            })

            $('.planSubmit').click(function () {
                if ($('textarea[name=progress]').val() == '' || ($('input[name=percent]').val() == '')) {
                    layer.msg('进度详情和百分比不能为空')
                    $(this).removeClass('btn-submit');
                } else {
                    $(this).addClass('btn-submit');
                }
            })

        });
        
        $('input[name="is_diary"]').on('click',function(){
            var checked = $(this).attr('checked');
            if(checked == 'checked'){
                
            }else{
               $(this).parent().addClass('radio_bg_check');
               $(this).attr('checked',true);
               $(this).parents('lable').siblings().find("i").removeClass('radio_bg_check');
                $(this).parents('lable').siblings().find("input").attr('checked',false);
            }
        })
//        $(function(){
//            var tag = false,ox = 0,left = 0,bgleft = 0;
//            $('.progress_btn').mousedown(function(e) {
//                ox = e.pageX - left;
//                tag = true;
//            });
//            $(document).mouseup(function() {
//                tag = false;
//            });
//            $('.progress').mousemove(function(e) {
//                if (tag) {
//                    left = e.pageX - ox;
//                    if(left <= 0){
//                        left = 0;
//                    }else if(left > 300){
//                        left = 300;
//                    }
//                    $('.progress_btn').css('left', left);
//                    $('.progress_bar').width(left);
//                    $('.text').html(parseInt((left/300)*100) + '%');
//                }
//            });
//            $('.progress_bg').click(function(e) {
//                if (!tag) {
//                    bgleft = $('.progress_bg').offset().left;
//                    left = e.pageX - bgleft;
//                    if (left <= 0) {
//                        left = 0;
//                    }else if (left > 300) {
//                        left = 300;
//                    }
//                    $('.progress_btn').css('left', left);
//                    $('.progress_bar').animate({width:left},300);
//                    $('.text').html(parseInt((left/300)*100) + '%');
//                }
//            })
//        })
    </script>
</block>
